﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace GenerateMovieList
{
    public partial class Popup : Form
    {
        public Popup()
        {
            InitializeComponent();
        }
        public Popup(string moviename, string overview, string url,string imdb)
        {
            InitializeComponent();
            load(moviename, overview, url,imdb);
        }

        private string urlweb = "";
        private string imdburl = "";
        private string imdbidnr = "";

        [DllImport("user32.dll")]
        static extern bool GetCursorPos(ref Point lpPoint);

        private void load(string moviename, string overview, string url,string imdbid)
        {
            this.Text = moviename;
            rtbOverview.Text = overview;
            urlweb = url;
            imdbidnr = imdbid;
            imdburl = "http://www.imdb.com/title/" + imdbid;
        }

        private void tsmiURL_Click(object sender, EventArgs e)
        {
            System.Diagnostics.Process.Start(urlweb);
        }

        private void tsmiClose_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void rtbOverview_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                Point defPnt = new Point();
                GetCursorPos(ref defPnt);
                cmsMenu.Show(defPnt.X, defPnt.Y);
            }
        }

        private void tsmiIMDB_Click(object sender, EventArgs e)
        {
            if(imdbidnr != string.Empty)
            System.Diagnostics.Process.Start(imdburl);
        }
    }
}
